<?php

function db_init() {
	global $db_link;

	// if already set we exit
	if(isset($db_link)) {
		return true;
	}

	// connect to the db
	$db_link = mysql_connect('localhost', 'dispatch', 'dispatchpw');

	// if connection was successful
	if($db_link !== false) {
		$query = "use dispatch";
		$result = mysql_query($query);
		// assume this worked successfully
	}
	else {
		echo "db connect failed<br />";
	}

	return false;
}

?>
